home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-28 | 5.9 KB | 186 lines | [TEXT/MPS ] |
- {
- File: TranslationExtensions.p
-
- Contains: Pascal Interface definitions for translation extension writers.
-
- Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
- }
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT TranslationExtensions;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED TranslationExtensions}
- {$SETC TranslationExtensions := 1}
-
- {$I+}
- {$SETC TranslationExtensionsIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
- {$IFC UNDEFINED UsingMemory}
- {$I $$Shell(PInterfaces)Memory.p}
- {$ENDC}
- {$IFC UNDEFINED UsingFiles}
- {$I $$Shell(PInterfaces)Files.p}
- {$ENDC}
- {$IFC UNDEFINED UsingQuickdraw}
- {$I $$Shell(PInterfaces)Quickdraw.p}
- {$ENDC}
- {$IFC UNDEFINED UsingComponents}
- {$I $$Shell(PInterfaces)Components.p}
- {$ENDC}
-
- {$IFC UNDEFINED UsingTranslationExtensions}
- {$I TranslationExtensions.p}
- {$ENDC}
-
- {$SETC UsingIncludes := TranslationExtensionsIncludes}
-
-
- CONST
- kSupportsFileTranslation = 1;
- kSupportsScrapTranslation = 2;
-
- { special error codes that DoTranslateFile can return }
- { userCanceledErr = -128; } {user hit cancel button in progress dialog, or error handled by extension }
- invalidTranslationPathErr = -3025; {srcType to dstType is not a valid path ••• move into Errors.h }
- couldNotParseSourceFileErr = -3026; {the source document does not contain srcType ••• move into Errors.h }
-
- { translation attributes }
- taDstDocNeedsResourceFork = 1;
- taDstIsAppTranslation = 2;
-
- { ComponentMgr selectors for routines }
- kTranslateGetFileTranslationList = 0; { component selectors }
- kTranslateIdentifyFile = 1;
- kTranslateTranslateFile = 2;
- kTranslateGetScrapTranslationList = 10; { skip to scrap routines }
- kTranslateIdentifyScrap = 11;
- kTranslateTranslateScrap = 12;
-
-
- TYPE
-
- { better names for 4-char codes }
- FileType = OSType;
- ScrapType = ResType;
-
- TranslationAttributes = LONGINT;
- FileTypeSpec = RECORD
- format: FileType;
- hint: LONGINT;
- flags: TranslationAttributes; { taDstDocNeedsResourceFork, taDstIsAppTranslation }
- catInfoType: OSType;
- catInfoCreator: OSType;
- END;
-
- FileTranslationListPtr = ^FileTranslationList;
- FileTranslationListHandle = ^FileTranslationListPtr;
- FileTranslationList = RECORD
- modDate: LONGINT;
- groupCount: LONGINT;
- { group1SrcCount: LONGINT; }
- { group1SrcEntrySize: LONGINT = sizeof(FileTypeSpec); }
- { group1SrcTypes = ARRAY[group1SrcCount] OF FileTypeSpec; }
- { group1DstCount: LONGINT;
- { group1DstEntrySize: LONGINT = sizeof(FileTypeSpec); }
- { group1DstTypes = ARRAY[group1DstCount] OF FileTypeSpec; }
- END;
-
- ScrapTypeSpec = RECORD
- format: ScrapType;
- hint: LONGINT;
- END;
-
- ScrapTranslationListPtr = ^ScrapTranslationList;
- ScrapTranslationListHandle = ^ScrapTranslationListPtr;
- ScrapTranslationList = RECORD
- modDate: LONGINT;
- groupCount: LONGINT;
- { group1SrcCount: LONGINT; }
- { group1SrcEntrySize: LONGINT = sizeof(ScrapTypeSpec); }
- { group1SrcTypes = ARRAY[group1SrcCount] OF ScrapTypeSpec; }
- { group1DstCount: LONGINT;
- { group1DstEntrySize: LONGINT = sizeof(ScrapTypeSpec); }
- { group1DstTypes = ARRAY[group1DstCount] OF ScrapTypeSpec; }
- END;
-
- { definition of callbacks to update progress dialog }
- TranslationRefNum = LONGINT;
-
- {
- //////////////////////////////////////////////////////////////////////////////////////////////
- //
- // This routine sets the advertisement in the top half of the progress dialog.
- // It is called once at the beginning of your DoTranslateFile routine.
- //
- // Enter: refNum Translation reference supplied to DoTranslateFile.
- // advertisement A handle to the picture to display. This must be non-purgable.
- // Before returning from DoTranslateFile, you should dispose
- // of the memory. (Normally, it is in the temp translation heap
- // so it is cleaned up for you.)
- //
- // Exit: returns noErr, paramErr, or memFullErr
- //
- }
- FUNCTION SetTranslationAdvertisement( refNum : TranslationRefNum;
- advertisement : PicHandle): OSErr;
- INLINE $7002, $ABFC;
-
-
- {
- //////////////////////////////////////////////////////////////////////////////////////////////
- //
- // This routine updates the progress bar in the progress dialog.
- // It is only called from within your DoTranslateFile routine.
- // It should be called often, so that the user will get feedback if he tries to cancel.
- //
- // Enter: refNum translation reference supplied to DoTranslateFile.
- // progress percent complete (0-100)
- //
- // Exit: canceled TRUE if the user clicked the Cancel button, FALSE otherwise
- // returns noErr, paramErr, or memFullErr
- //
- }
- FUNCTION UpdateTranslationProgress(refNum : TranslationRefNum;
- percentDone : INTEGER;
- VAR canceled : Boolean): OSErr;
- INLINE $7001, $ABFC;
-
-
- { implement these if you are writing a File Translation Extension }
- {
- FUNCTION DoGetFileTranslationList(self: ComponentInstance; translationList: FileTranslationListHandle) : ComponentResult;
-
- FUNCTION DoIdentifyFile(self: ComponentInstance; theDoc: FSSpec; VAR docKind: FileType) : ComponentResult;
-
- FUNCTION DoTranslateFile(self: ComponentInstance; refNum: TranslationRefNum;
- srcDoc: FSSpec; srcType: FileType; srcTypeHint: LONGINT;
- dstDoc: FSSpec; dstType: FileType; dstTypeHint: LONGINT) : ComponentResult;
- }
-
-
-
- { implement these if you are writing a Scrap Translation Extension }
- {
- FUNCTION DoGetScrapTranslationList(self: ComponentInstance; list: ScrapTranslationListHandle) : ComponentResult;
-
- FUNCTION DoIdentifyScrap(self: ComponentInstance; dataPtr: Ptr; dataLength: Size;
- VAR dataFormat: ScrapType) : ComponentResult;
-
- FUNCTION DoTranslateScrap(self: ComponentInstance; refNum: TranslationRefNum;
- srcDataPtr: Ptr; srcDataLength: Size; srcType: ScrapType;
- srcTypeHint: LONGINT; dstData: Handle; dstType: ScrapType;
- dstTypeHint: LONGINT) : ComponentResult;
- }
-
- {$ENDC} { UsingTranslationExtensions }
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-